from typing import List


class Solution:
    def getMaximumConsecutive(self, coins: List[int]) -> int:
        coins.sort()
        now = 0
        for coin in coins:
            if coin > now + 1:
                return now + 1
            else:
                now += coin
        return now + 1


if __name__ == "__main__":
    print(Solution().getMaximumConsecutive([1, 3]))  # 2
    print(Solution().getMaximumConsecutive([1, 1, 1, 4]))  # 8
    print(Solution().getMaximumConsecutive([1, 4, 10, 3, 1]))  # 20
